package com.yuke.cloud.service.pmc.service.impl;

import com.yuke.cloud.service.api.opc.dto.UploadFile;
import com.yuke.cloud.service.api.opc.service.OpcFileFeignApi;
import com.yuke.cloud.service.pmc.dao.ProdRegionPictureMapper;
import com.yuke.cloud.service.pmc.entity.ProdRegionPicture;
import com.yuke.cloud.service.pmc.service.ProdRegionPictureService;
import com.yuke.cloud.common.core.support.BaseService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;


/**
 * Created by zys on 2018/09/30.
 */
@Service
@Transactional
public class ProdRegionPictureServiceImpl extends BaseService<ProdRegionPicture> implements ProdRegionPictureService {
    @Resource
    private ProdRegionPictureMapper prodRegionPictureMapper;

    @Override
    public int save(ProdRegionPicture record) {
        record.setRegionPictureId(generateId());
        return super.save(record);
    }

    @Override
    public int update(ProdRegionPicture entity) {
        int count = super.update(entity);
        return count;
    }

    @Override
    public List<String> getPicturesByRegionId(Long regionId) {
        return prodRegionPictureMapper.getPicturesByRegionId(regionId);
    }

    @Override
    public void deleteByRegionIds(List<Long> regionIds) {
        prodRegionPictureMapper.deleteByRegionIds(regionIds);
    }

    @Override
    public List<ProdRegionPicture> getProdRegionPictureByRegionIds(List<Long> regionIds) {
        return prodRegionPictureMapper.getProdRegionPictureByRegionIds(regionIds);
    }
}
